<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="input" />
<button id="send">发送</button>
<div class="chat" ></div>
<script>
    let btn = document.getElementById('send');
    const inputValue = document.getElementById("input");
    btn.onclick = function () {
        console.log(inputValue.value)
        // fetch 默认为 get 请求
        fetch('/startChat', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: inputValue.value
        }).then(res => res.json()).then(data => {
                console.log(data)
            });
    }


    let json = {
        name: 'zhangsan',
        age: 18
    };

</script>
</body>
</html>